<div class="form-area" id="base-form">
<form id="form-base" action="/resume/basic/edit" method="post">
<input type="hidden" name="method" value="do"/>
<input type="hidden" name="CSRFToken" value="${CSRFToken!}"/>
<input type="hidden" name="type" value="basic">
<table width="100%" class="dj-form-base copy">
<colgroup>
    <col width="200">
    <col width="*">
</colgroup>
<tbody><tr>
            <th><em>*</em>当前状态:</th>
            <td class="input" colspan="3">
                <select id="status" name="status"  class="select J_check public-select J_able_i" >
                    <option value="">请选择</option>
                        <option value="1" <#if invitationApply.intentionInfo?? && invitationApply.intentionInfo.status?? && invitationApply.intentionInfo.status==1>selected</#if> >在职</option>
                        <option value="2" <#if invitationApply.intentionInfo?? && invitationApply.intentionInfo.status?? && invitationApply.intentionInfo.status==2>selected</#if> >不在职</option>
                </select>
                <div style="display: none; " class="error" id="status_error">请选择当前状态</div>
            </td>
        </tr>
        <tr>
            <th><em>*</em>意向行业</th>
            <td class="input">
                 	<#assign industryParentId = 0 />
				    <#assign industryId = 0 />
				    <#if invitationApply.intentionInfo.industry??>
				        <#assign industryParentId = (dictMap.DICT_CITY.map.get(invitationApply.intentionInfo.industry).parentId)!0 />
				        <#assign industryId = invitationApply.intentionInfo.industry />
				    </#if>
				        <select style="width:120px" class="industry_parent J_able_i" id="industry_parent" name="industry_parent">
				            <option value="">请选择</option>
				            <option value="1">IT行业</option>
							<option value="2">金融行业</option>
							<option value="3">专业服务</option>
							<option value="4">教育培训行业</option>
							<option value="5">消费品行业</option>
							<option value="6">文化传媒行业</option>
							<option value="7">建筑/房地产行业</option>
							<option value="8">贸易物流行业</option>
							<option value="9">制造工业</option>
							<option value="10">医疗/卫生</option>
							<option value="11">服务业</option>
							<option value="12">其他</option>
				        </select>
				        <select style="width:160px" name="industry" id="industry" class="J_able_i">
				        	<option value="" selected="selected">请选择</option>
				        </select>
				        <script type="text/javascript">
				             $("#industry_parent").change(function()
				             {
								var industry_parent = $(this).val();
								if(industry_parent == '') return;
								var html = '<option value="" selected="selected">请选择</option>';
								$.ajax({
									url:"/ajax/dict?type=position_industry&id="+industry_parent,
									type:"GET",
									success:function(res)
									{
										json = eval(res);
										$(json).each(function(){
											html +='<option value="'+this.id+'">'+this.text+'</option>';
										});
										$("#industry").html(html);
									},
									failed:function(r)
									{
										alert("网络错误！");
									}
								});
							}); 
				        </script>
                <div style="display:none;" class="J_Error" id="industry_error">请选择意向行业</div>
            </td>
        </tr>
        <tr>
            <th>期望薪资:</th>
            <td class="input" colspan="3">
                <select id="expectSalary" name="expectSalary" reg="^[^0]" class="select  public-select J_able_i" >
                    <option value="">请选择</option>
                    <option value="125">￥ 1000及以上</option>
                    <option value="126">￥ 1500及以上</option>
                    <option value="127">￥ 2000及以上</option>
                    <option value="150">￥ 2500及以上</option>
                    <option value="128">￥ 3000及以上</option>
                    <option value="129">￥ 4000及以上</option>
                    <option value="130">￥ 5000及以上</option>
                    <option value="131">￥ 6000及以上</option>
                    <option value="132">￥ 8000及以上</option>
                    <option value="133">￥ 10000及以上</option>
                    <option value="134">￥ 15000及以上</option>
                    <option value="135">￥ 20000及以上</option>
                    <option value="136">￥ 30000及以上</option>
                    <option value="137">￥ 50000及以上</option>
                </select>
                <div style="display: none; " class="error">请选择期望薪资</div>
            </td>
        </tr>
        <tr>
            <th>目前薪资:</th>
            <td class="input" colspan="3">
                <input type="text" value="" reg="^.+$" class="text select-beauty J_able_i" id="curSalary" name="curSalary"
                	value="<#if invitationApply.intentionInfo?? && invitationApply.intentionInfo.curSalary?? && invitationApply.intentionInfo.curSalary gt 0>${invitationApply.intentionInfo.curSalary}</#if>">
            </td>
        </tr>
		<tr>
		    <th>&nbsp;</th>
		    <td class="input button">
		        <a href="javascript:void(0);" itemtype="base" class="fresh formValidateSubmit margin"
		           id="J_intentionSubmit" onclick="saveIntention()"><span>保存</span></a>
		        <a href="javascript:void(0);" style="display:none" class="normal J_cancel" itemtype="base"><span>取消</span></a>
		    </td>
		</tr>
</tbody>
</table>

</div>
<@holder>
<script type="text/javascript">

	$(".J_able_i").change(function(){
		$("#J_intentionSubmit").attr("class","fresh formValidateSubmit margin");
	});

	$("#J_intentionSubmit").click()
	{
		var expectSalary = <#if invitationApply.intentionInfo?? && invitationApply.intentionInfo.expectSalary?? && invitationApply.intentionInfo.expectSalary gt 0>${invitationApply.intentionInfo.expectSalary}<#else>""</#if>;
		var industry = <#if invitationApply.intentionInfo?? && invitationApply.intentionInfo.industry?? && invitationApply.intentionInfo.industry gt 0>${invitationApply.intentionInfo.industry}<#else>""</#if>;
		$("#expectSalary option[value='"+expectSalary+"']").attr("selected", true );
	}
	
	$("#status").change(function()
	{
		$("#status_error").attr("style","display:none");
	})
	
	
	$("#industry_parent").change(function()
	{
		$("#industry_error").attr("style","display:none");
	})
	
	$("#industry").change(function()
	{
		$("#industry_error").attr("style","display:none");
	})
	
	var saveIntention = function()
	{
		var status = $("#status").val();
		var industry = $("#industry").val();
		var expectSalary = $("#expectSalary").val();
		var curSalary = $("#curSalary").val();
		
		var params = "";
		var isReturn = false;
		if(status != "")
		{
				params += "&status="+status;
			$("#status_error").attr("style","display:none");
		}else
		{
			$("#status_error").attr("style","display:");
				isReturn = true;
		}
		if(industry != "")
		{
				params += "&industry="+industry;
			$("#industry_error").attr("style","display:none")
		}else
		{
			$("#industry_error").attr("style","display:")
				isReturn = true;
		}
		if(expectSalary != "") 	params += "&expectSalary="+expectSalary;
		if(curSalary != "" )	params += "&curSalary="+curSalary;
		if(isReturn || params == "")
		{
			return;
		}else
		{
			params = params.substring(1);
		}
		
		$.ajax({
			url:"/invitation/saveIntention"+"?"+params, 
			type:"POST",
			success:function(res)
			{
				//alert("保存成功！");
				$("#J_intentionSubmit").attr("class","normal");
			},
			failed:function(res)
			{
				alert("网络错误！");
			}
		});
	}
</script>
</@holder>